<template>
    <div id='' class='card_view'>
        <div class="content">
            <CardRow ref="cardRow" v-for="(item,index) in list" :key="index" :eachItem="item.value" :title="item.key" />
        </div>
    </div>
</template>
<script>
import CardRow from './card_row.vue'

export default {
    name: '',
    props: [''],
    data() {
        return {
            list: []
        };
    },
    components: { CardRow },
    computed: {},
    provide() {
        return {
            changeActive: this.activeFunc
        }
    },
    beforeMount() { },
    mounted() { },
    created() {
        // 模拟数据
        // this.$http.$get('loadGetHomeCard', { params: {},baseUrl:'mockService' }).then(res => {
        this.$http.$post('subsystemAuthList', { params: {} }).then(res => {
            if (res.code == 200) {
                for (let i = 0; i < res.data.length; i++) {
                    const element = res.data[i];
                    if (element.value.length !== 0) {
                        for (let j = 0; j < element.value.length; j++) {
                            const t = element.value[j];
                            t['img'] = window.config.fileServer + 'show/' + t.img;
                        }
                    }
                }
                this.list = res.data;
            }
        })
    },
    methods: {
        activeFunc(test, event) {
            // 解开代码，有选中效果，否则没有选中效果
            // this.active = event.title
            // return
            // console.log('%o',event)
            icu.storage.setData([
                {
                    key: 'subsystemId',
                    value: event.id
                }
            ]);
            // return
            window.location.href = event.path;// "http://localhost:8081/#/name/fontApp";
        }
    },
    watch: {}
}
</script>
<style lang='less' scoped>
.card_view {
    width: 100%;
    background: #ffffff;
    padding: 20px 0;
    color: #fff;
    display: flex;
    justify-content: center;
    .content {
        width: 67%;
        color: #605b5b;
        padding: 0 20px;
    }
}
</style>